﻿using System;
using System.Collections.Generic;
using System.Linq;

namespace QuickModel.ColumnTransModel
{
	[Grouper(GrouperName = "ColumnFamilySymbolGrouper")]
	public class ColumnFamilySymbolGrouper : IDataGrouper
	{
		public List<RevitModelRequest> GroupData(InputRequest inputRequest)
		{
			List<RevitModelRequest> list = new List<RevitModelRequest>();
			try
			{
				ColumnFamilySymbolRequest columnFamilySymbolRequest = inputRequest as ColumnFamilySymbolRequest;
				bool flag = columnFamilySymbolRequest == null;
				if (flag)
				{
					return list;
				}
				foreach (KeyValuePair<ColumnConfigInfo, List<ColumnLoopInfo>> keyValuePair in columnFamilySymbolRequest.ConfigAndLoop)
				{
					list.Add(new ColumnFamilySymbolRevitRequst
					{
						Config = keyValuePair.Key,
						LoopInfo = keyValuePair.Value.FirstOrNull<ColumnLoopInfo>()
					});
				}
			}
			catch (Exception)
			{
			}
			return list;
		}
	}
}
